﻿using System.ComponentModel;

namespace RIBA.Web
{
	/// <summary>
	/// Wraps access to the strongly typed resource classes so that you can bind
	/// control properties to resource strings in XAML
	/// </summary>
	public sealed class TextResWrapper : INotifyPropertyChanged
	{
		public TextResWrapper()
		{
			if (_textResource != null)
				return;

			_textResource = new TextRes();
		}

		public event PropertyChangedEventHandler PropertyChanged;
		public void OnPropertyChanged(PropertyChangedEventArgs e)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, e);
		}

		private static TextRes _textResource;

		public TextRes TextResource
		{
			get
			{
				return _textResource;
			}
			set
			{
				_textResource = value;

				OnPropertyChanged(new PropertyChangedEventArgs("TextResource"));
			}
		}
	}
}